﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Framework.Common;
using Dal.Entities;
using PDFHelper.Helper;
namespace Web.Controllers
{
    [MyAuthAttribute(Role = 0)]
    [ValidateInput(false)]
    public class DocController : Controller
    {
        int doctype;
        int docid;
        string status = string.Empty;
        Framework.Data.IRepository rep;

        public DocController()
        {
            rep = Framework.Data.RepositoryFactory.GetRepository();
            //docid
            docid = TypeConvertHelper.StrToInt(System.Web.HttpContext.Current.Request["docid"], 0);
            ViewBag.DocID = docid;
            //doc type
            doctype = Common.DocType();
            ViewBag.DocType = doctype;

            ViewBag.Status = System.Web.HttpContext.Current.Request["status"] ?? "edit";

            //Dal.Entities.Doc doc = rep.GetByKey<Doc>(docid);
        }

        public ActionResult AddBaseInfo()
        {
            Dal.Entities.Doc doc = new Dal.Entities.Doc
            {
                DocType = doctype,
                StatusAudit = 0,
                StatusComplete = 0,
                StatusQuestion = 0,
                StatusValid = 1,
                TimeAdd = DateTime.Now,
                UserID = Common.GetUserID()
            };

            rep.Add(doc);
            rep.Save();

            rep.Add(new DocCommon { DocID = doc.DocID });
            rep.Add(new Doc1 { DocID = doc.DocID });
            rep.Add(new Doc2 { DocID = doc.DocID });
            rep.Add(new Doc3 { DocID = doc.DocID });
            if (doc.DocType == 2)
            {
                rep.Add(new Doc4 { DocID = doc.DocID });
            }
            if (rep.Save() > 0)
            {
                return RedirectToAction("editcommon", new { docid = doc.DocID, doctype = doc.DocType });
            }
            return null;
        }
        #region editcommon
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult EditCommon()
        {
            var doccommon = rep.GetByKey<Dal.Entities.DocCommon>(docid);
            return View(doccommon);
        }
        /// <summary>
        /// 只保存不跳转
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult EditCommon(FormCollection form, string buttonsave, string auditbutton)
        {
            if (!string.IsNullOrWhiteSpace(auditbutton))
            {
                int audit = TypeConvertHelper.StrToInt(auditbutton);
                DocCommon docAudit = new DocCommon { DocID = docid, StatusAudit = -1 };
                ViewBag.Result = rep.AttachThenSaveChange(docAudit, i => i.StatusAudit = audit);
                Common.SetAudit(docid);
                Common.AlertRedirect("操作成功", "/doc/edit1?status=audit&docid=" + docid);
                return new EmptyResult();
            }
            var doccommon = rep.GetByKey<Dal.Entities.DocCommon>(docid);
            rep.Attach(doccommon);
            TryUpdateModel<Dal.Entities.DocCommon>(doccommon);
            doccommon.StatusComplete = CheckComplete(
                doccommon.InputTime,
                doccommon.DoctorName,
                doccommon.SubjectName,
                doccommon.DoctorMobile,
                doccommon.HospitalName) ? 1 : 0;

            ViewBag.Result = rep.Save() > 0;
            Common.SetComplete(docid);
            if (buttonsave != null)
            {
                Common.AlertRedirect("操作成功", "/doc/editcommon?docid=" + docid);
                return new EmptyResult();
            }
            else
            {
                if (Request["buttonquestion"] != null)
                {
                    Common.UpdateModifyStatus(docid);
                }
                return RedirectToAction("edit1", new { docid = docid }); //(doccommon);
            }
        }
        #endregion

        [HttpGet]
        public ActionResult Edit1()
        {
            var doc1 = rep.GetByKey<Doc1>(docid);
            return View(doc1);
        }

        [HttpPost]
        public ActionResult Edit1(FormCollection form, string[] Diseases, string buttonsave, string auditbutton)
        {
            if (!string.IsNullOrWhiteSpace(auditbutton))
            {
                int audit = TypeConvertHelper.StrToInt(auditbutton);
                Doc1 docAudit = new Doc1 { DocID = docid, StatusAudit = -1 };
                ViewBag.Result = rep.AttachThenSaveChange(docAudit, i => i.StatusAudit = audit);
                Common.SetAudit(docid);
                Common.AlertRedirect("操作成功", "/doc/edit2?status=audit&docid=" + docid);
                return new EmptyResult();
            }
            var doc1 = rep.GetByKey<Doc1>(docid);
            rep.Attach(doc1);
            TryUpdateModel<Doc1>(doc1);
            if (Diseases != null)
            {
                doc1.Diseases = string.Join(",", Diseases);
            }
            else
            {
                doc1.Diseases = null;
            }

            doc1.StatusComplete = CheckComplete(
                doc1.Weight,
                doc1.Sex,
                doc1.Score,
                doc1.PatientName,
                doc1.Mobile,
                doc1.Job,
                doc1.Insurance,
                doc1.Income,
                doc1.Height,
                doc1.FamilyHistory,
                doc1.FamilyAddress,
                doc1.Education,
                doc1.Diseases,
                doc1.DiagnoseTime,
                doc1.Age
                ) ? 1 : 0;
            ViewBag.Result = rep.Save() > 0;
            Common.SetComplete(docid);

            if (buttonsave != null)
            {
                Common.AlertRedirect("操作成功", "/doc/edit1?docid=" + docid);
                return new EmptyResult();
                //return View("Edit1", doc1);
            }
            else
            {
                if (Request["buttonquestion"] != null)
                {
                    Common.UpdateModifyStatus(docid);
                }
                return RedirectToAction("Edit2", new { docid = docid });
            }
        }

        [HttpGet]
        public ActionResult Edit2()
        {
            var doc2 = rep.GetByKey<Doc2>(docid);
            return View(doc2);
        }

        [HttpPost]
        public ActionResult Edit2(FormCollection form
            , string[] reason
            , string[] AdditionCaseYDS
            , string[] OldTreatment_2
            , string buttonsave
            , string auditbutton
            )
        {
            if (!string.IsNullOrWhiteSpace(auditbutton))
            {
                int audit = TypeConvertHelper.StrToInt(auditbutton);
                Doc2 docAudit = new Doc2 { DocID = docid, StatusAudit = -1 };
                ViewBag.Result = rep.AttachThenSaveChange(docAudit, i => i.StatusAudit = audit);
                Common.SetAudit(docid);
                Common.AlertRedirect("操作成功", "/doc/edit3?status=audit&docid=" + docid);
                return new EmptyResult();
            }

            var doc2 = rep.GetByKey<Doc2>(docid);
            rep.Attach(doc2);
            TryUpdateModel(doc2);

            doc2.Reason = reason == null ? null : string.Join(",", reason);
            doc2.AdditionCaseYDS = AdditionCaseYDS == null ? null : string.Join(",", AdditionCaseYDS);
            doc2.OldTreatment_2 = OldTreatment_2 == null ? null : string.Join(",", OldTreatment_2);
            if (doctype == 1)
            {
                doc2.StatusComplete = CheckComplete(
                      doc2.BloodSugarAfterDinner,
                      doc2.BloodSugarEmpty,
                      doc2.DetectDate,
                      doc2.Hba1c,
                      doc2.Reason) ? 1 : 0;
            }
            else if (doctype == 2)
            {
                doc2.StatusComplete = CheckComplete(
                                    doc2.BloodSugarAfterDinner,
                                    doc2.BloodSugarEmpty,
                                    doc2.DetectDate,
                                    doc2.Hba1c,
                                    doc2.Reason,
                                    doc2.OldTreatment_2
                                    ) ? 1 : 0;
            }

            ViewBag.Result = rep.Save() > 0;
            Common.SetComplete(docid);

            if (buttonsave != null)
            {
                Common.AlertRedirect("操作成功", "/doc/edit2?docid=" + docid);
                return new EmptyResult();
                //return View("Edit2", doc2);
            }
            else
            {
                if (Request["buttonquestion"] != null)
                {
                    Common.UpdateModifyStatus(docid);
                }
                return RedirectToAction("Edit3", new { docid = docid });
            }
        }
        [HttpGet]
        public ActionResult Edit3()
        {
            var doc3 = rep.GetByKey<Doc3>(docid);
            return View(doc3);
        }
        [HttpPost]
        public ActionResult Edit3(FormCollection form
            , string[] T1BeforeBreakfastArray
            , string[] T1BeforeLunchArray
            , string[] T1BeforeDinnerArray
            , string[] T1NuoHePingArray
            , string[] T2EmptyArray
            , string[] T2AfterBreakfastArray
            , string[] T2BeforeLunchArray
            , string[] T2AfterLunchArray
            , string[] T2BeforeDinnerArray
            , string[] T2AfterDinnerArray
            , string[] T2BeforeSleep
            , string[] AdjustCase_2
            , string buttonsave
            , string auditbutton
            )
        {
            if (!string.IsNullOrWhiteSpace(auditbutton))
            {
                int audit = TypeConvertHelper.StrToInt(auditbutton);
                Doc3 docAudit = new Doc3 { DocID = docid, StatusAudit = -1 };
                ViewBag.Result = rep.AttachThenSaveChange(docAudit, i => i.StatusAudit = audit);
                Common.SetAudit(docid);
                if (doctype == 1)
                {
                    Common.AlertRedirect("操作成功", "/doc/manage");
                }
                else
                {
                    Common.AlertRedirect("操作成功", "/doc/edit4?status=audit&docid=" + docid);
                }
                return new EmptyResult();
            }
            var doc3 = rep.GetByKey<Doc3>(docid);
            rep.Attach(doc3);
            TryUpdateModel(doc3);
            doc3.T1BeforeBreakfastArray = GetStringFromArray(T1BeforeBreakfastArray);
            doc3.T1BeforeLunchArray = GetStringFromArray(T1BeforeLunchArray);
            doc3.T1BeforeDinnerArray = GetStringFromArray(T1BeforeDinnerArray);
            doc3.T1NuoHePingArray = GetStringFromArray(T1NuoHePingArray);

            doc3.T2EmptyArray = GetStringFromArray(T2EmptyArray);
            doc3.T2AfterBreakfastArray = GetStringFromArray(T2AfterBreakfastArray);
            doc3.T2BeforeLunchArray = GetStringFromArray(T2BeforeLunchArray);
            doc3.T2AfterLunchArray = GetStringFromArray(T2AfterLunchArray);
            doc3.T2BeforeDinnerArray = GetStringFromArray(T2BeforeDinnerArray);
            doc3.T2AfterDinnerArray = GetStringFromArray(T2AfterDinnerArray);
            doc3.T2BeforeSleep = GetStringFromArray(T2BeforeSleep);

            doc3.AdjustCase_2 = GetStringFromArray(AdjustCase_2);
            if (doctype == 1)
            {
                doc3.StatusComplete = CheckComplete(
                    doc3.BeforeSleep
                    ) ? 1 : 0;
            }
            else if (doctype == 2)
            {
                doc3.StatusComplete = CheckComplete(
                    doc3.AdjustCase_2,
                    doc3.BeforeBreakfast_2,
                    doc3.BeforeDinner_2,
                    doc3.BeforeLunch_2,
                    doc3.BeforeSleep,
                    doc3.Effect_2,
                    doc3.HasLowBloodSugar_2,
                    doc3.Satisfied_2
                    ) ? 1 : 0;
            }
            ViewBag.Result = rep.Save() > 0;
            Common.SetComplete(docid);

            if (buttonsave != null)
            {
                Common.AlertRedirect("操作成功", "/doc/edit3?docid=" + docid);
                return new EmptyResult();
                //return View("Edit3", doc3);
            }
            else
            {
                if (Request["buttonquestion"] != null)
                {
                    Common.UpdateModifyStatus(docid);
                }
                return RedirectToAction("Edit4", new { docid = docid });
            }
        }

        [HttpGet]
        public ActionResult Edit4()
        {
            var doc4 = rep.GetByKey<Doc4>(docid);
            return View(doc4);
        }

        [HttpPost]
        public ActionResult Edit4(string buttonsave, string auditbutton)
        {
            if (!string.IsNullOrWhiteSpace(auditbutton))
            {
                int audit = TypeConvertHelper.StrToInt(auditbutton);
                Doc4 docAudit = new Doc4 { DocID = docid, StatusAudit = -1 };
                ViewBag.Result = rep.AttachThenSaveChange(docAudit, i => i.StatusAudit = audit);
                Common.SetAudit(docid);
                Common.AlertRedirect("操作成功", "/doc/manage");
                return new EmptyResult();
            }
            var doc4 = rep.GetByKey<Doc4>(docid);
            rep.Attach(doc4);
            TryUpdateModel(doc4);
            doc4.StatusComplete = CheckComplete(
                doc4.EffectReduceBloodSugar,
                doc4.EffectSpeed,
                doc4.SafeFrequency,
                doc4.SafeTestAddYiDao,
                doc4.DinnerTime
                ) ? 1 : 0;
            ViewBag.Result = rep.Save() > 0;
            Common.SetComplete(docid);

            if (buttonsave != null)
            {
                Common.AlertRedirect("操作成功", "/doc/manage");
                return new EmptyResult();
                // return View("Edit4", doc4);
            }
            if (Request["buttonquestion"] != null)
            {
                Common.UpdateModifyStatus(docid);
                Common.AlertRedirect("操作成功", "/doc/manage");
                return new EmptyResult();
            }
            return View(doc4);
        }


        public ActionResult Manage()
        {
            QueryModel query = new QueryModel();
            TryUpdateModel(query);
            int pageindex = TypeConvertHelper.StrToInt(Request["pageindex"], 1);
            IQueryable<DocForShow> list = null;

            list = from doc in rep.GetQuery<Doc>()
                   join user in rep.GetQuery<User>()
                   on doc.UserID equals user.ID
                   where doc.DocType == doctype && doc.StatusValid == 1
                   orderby doc.TimeUpdate descending
                   select new DocForShow
                   {
                       doc = doc,
                       username = user.UserName
                   };

            if (Common.GetUserRole() == 0)
            {
                int userid = Common.GetUserID();
                list = list.Where(i => i.doc.UserID == userid);
            }
            if (query.DocNO.HasValue)
            {
                list = list.Where(i => i.doc.DocID == query.DocNO.Value);
            }
            if (!string.IsNullOrEmpty(query.UserName))
            {
                var user = rep.First<User>(i => i.UserName == query.UserName);
                if (user != null)
                {
                    list = list.Where(i => i.doc.UserID == user.ID);
                }
            }
            if (query.InputStart.HasValue)
            {
                list = list.Where(i => i.doc.TimeAdd >= query.InputStart.Value);
            }
            if (query.InputEnd.HasValue)
            {
                list = list.Where(i => i.doc.TimeAdd <= query.InputEnd.Value);
            }
            if (query.AuditStart.HasValue)
            {
                list = list.Where(i => i.doc.TimeAudit >= query.AuditStart);
            }
            if (query.AuditEnd.HasValue)
            {
                list = list.Where(i => i.doc.TimeAudit <= query.AuditEnd);
            }
            if (query.StatusComplete.HasValue && query.StatusComplete.Value != -1)
            {
                list = list.Where(i => i.doc.StatusComplete == query.StatusComplete.Value);
            }
            if (query.StatusAudit.HasValue && query.StatusAudit.Value != -1)
            {
                list = list.Where(i => i.doc.StatusAudit == query.StatusAudit.Value);
            }
            if (query.StatusQuestion.HasValue && query.StatusQuestion.Value != -1)
            {
                list = list.Where(i => i.doc.StatusQuestion == query.StatusQuestion.Value);
            }
            if (query.StatusQuestionReply.HasValue && query.StatusQuestionReply.Value != -1)
            {
                list = list.Where(i => i.doc.StatusModify == query.StatusQuestionReply.Value);
            }
            ViewBag.RecordCount = list.Count();
            ViewBag.PageIndex = pageindex;
            list = list.OrderByDescending(i => i.doc.DocID).Skip((pageindex - 1) * 10).Take(10);
            ViewBag.Record = list.ToList();
            return View(query);
            //return View(query);

        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="docID"></param>
        /// <returns></returns>
        [MyAuth(Role = 0)]
        public ActionResult Delete()
        {
            rep.Attach(new Dal.Entities.Doc());
            Dal.Entities.Doc doc = new Doc { DocID = docid, StatusValid = -1 };
            rep.AttachThenSaveChange(doc, i => i.StatusValid = 0);
            Common.AlertRedirect("删除成功", "/doc/manage");
            return null;
        }


        public ActionResult Question(string field, int type, string description)
        {
            if (Request.HttpMethod.ToLower() == "post")
            {
                if (Request["close"] != null)//关闭
                {
                    var list = rep.Get<DocQuestion>(i => i.DocID == docid && i.FieldName == field && i.Type == type && i.Status == 0);
                    if (list != null)
                    {
                        foreach (var q in list)
                        {
                            rep.AttachThenSaveChange(q, i => i.Status = 1);
                        }
                        Common.UpdateQuestionStatus(docid);
                    }
                }
                else if (Request["submit"] != null)//提交信息
                {
                    string questionContent = Request["QContent"];
                    if (!string.IsNullOrEmpty(questionContent))
                    {
                        rep.AddThenSaveChange(new DocQuestion
                        {
                            DocID = docid,
                            FieldName = field,
                            Status = 0,//默认值是0
                            Type = type,
                            QContent = questionContent,
                            OperateTime = DateTime.Now,
                            OperateUserID = Common.GetUserID()
                        });
                        Common.UpdateQuestionStatus(docid);
                    }
                }
            }
            ViewBag.Param = new { field = field, type = type, description = description, docid = docid };
            var allquestion = rep.Get<DocQuestion>(i => i.DocID == docid && i.FieldName == field && i.Type == type);
            ViewBag.Question = allquestion.Where(i => i.Status == 0).ToList();
            ViewBag.QuestionClose = allquestion.Where(i => i.Status == 1).ToList();
            ViewBag.Description = description;
            return View(new DocQuestion { DocID = docid, FieldName = field, Type = type });
        }

        public ActionResult Export(int DocID)
        {
            string url = System.Configuration.ConfigurationManager.AppSettings["host"] + "/preview?docid=" + DocID;
            string exeFile = Server.MapPath("~/lib/wkhtmltopdf/wkhtmltopdf.exe");
            string savePath = Server.MapPath("~/Pdf/" + DocID + ".pdf");
            if (TextSharpHelper.HtmlToPdf(exeFile, url, savePath))
            {
                return File(savePath, "application/pdf", "病例NO" + DocID + ".pdf");
            }
            return new EmptyResult();
        }

        [NonAction]
        private string GetStringFromArray(string[] array)
        {
            return array == null ? null : string.Join(",", array);
        }

        [NonAction]
        private bool CheckComplete(params object[] objs)
        {
            return objs.Count(i => i == null) == 0 ? true : false;
        }



        #region excel 导出
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportExcel(QueryModel model)
        {
            QueryModel query = model;
            IQueryable<DocForShow> list = null;
            if (doctype == 1)
            {
                list = from doc in rep.GetQuery<Doc>()
                       join user in rep.GetQuery<User>()
                       on doc.UserID equals user.ID
                       join doc0 in rep.GetQuery<DocCommon>()
                       on doc.DocID equals doc0.DocID
                       join doc1 in rep.GetQuery<Doc1>()
                       on doc.DocID equals doc1.DocID
                       join doc2 in rep.GetQuery<Doc2>()
                       on doc.DocID equals doc2.DocID
                       join doc3 in rep.GetQuery<Doc3>()
                       on doc.DocID equals doc3.DocID
                       where doc.DocType == doctype && doc.StatusValid == 1
                       select new DocForShow
                       {
                           doc = doc,
                           doc0 = doc0,
                           doc1 = doc1,
                           doc2 = doc2,
                           doc3 = doc3,
                           username = user.UserName
                       };

            }
            else
            {
                list = from doc in rep.GetQuery<Doc>()
                       join user in rep.GetQuery<User>()
                       on doc.UserID equals user.ID
                       join doc0 in rep.GetQuery<DocCommon>()
                       on doc.DocID equals doc0.DocID
                       join doc1 in rep.GetQuery<Doc1>()
                       on doc.DocID equals doc1.DocID
                       join doc2 in rep.GetQuery<Doc2>()
                       on doc.DocID equals doc2.DocID
                       join doc3 in rep.GetQuery<Doc3>()
                       on doc.DocID equals doc3.DocID
                       join doc4 in rep.GetQuery<Doc4>()
                       on doc.DocID equals doc4.DocID
                       where doc.DocType == doctype && doc.StatusValid == 1
                       select new DocForShow
                       {
                           doc = doc,
                           doc0 = doc0,
                           doc1 = doc1,
                           doc2 = doc2,
                           doc3 = doc3,
                           doc4 = doc4,
                           username = user.UserName
                       };
            }
            if (query.DocNO.HasValue)
            {
                list = list.Where(i => i.doc.DocID == query.DocNO.Value);
            }

            if (Common.Admin())
            {
                if (!string.IsNullOrEmpty(query.UserName))
                {
                    var user = rep.First<User>(i => i.UserName == query.UserName);
                    if (user != null)
                    {
                        list = list.Where(i => i.doc.UserID == user.ID);
                    }
                    else
                    {
                        Common.AlertRedirect("未搜索到数据", "/doc/exportmanage");
                        return View(query);
                    }
                }
            }
            else
            {
                int currentUserID = Common.GetUserID();
                list = list.Where(i => i.doc.UserID == currentUserID);
            }

            if (!string.IsNullOrEmpty(query.UserName))
            {
                var user = rep.First<User>(i => i.UserName == query.UserName);
                if (user != null)
                {
                    list = list.Where(i => i.doc.UserID == user.ID);
                }
            }
            if (query.InputStart.HasValue)
            {
                list = list.Where(i => i.doc.TimeAdd >= query.InputStart.Value);
            }
            if (query.InputEnd.HasValue)
            {
                list = list.Where(i => i.doc.TimeAdd <= query.InputEnd.Value);
            }
            if (query.AuditStart.HasValue)
            {
                list = list.Where(i => i.doc.TimeAudit >= query.AuditStart);
            }
            if (query.AuditEnd.HasValue)
            {
                list = list.Where(i => i.doc.TimeAudit <= query.AuditEnd);
            }
            if (query.StatusComplete.HasValue && query.StatusComplete.Value != -1)
            {
                list = list.Where(i => i.doc.StatusComplete == query.StatusComplete.Value);
            }
            if (query.StatusAudit.HasValue && query.StatusAudit.Value != -1)
            {
                list = list.Where(i => i.doc.StatusAudit == query.StatusAudit.Value);
            }
            if (query.StatusQuestion.HasValue && query.StatusQuestion.Value != -1)
            {
                list = list.Where(i => i.doc.StatusQuestion == query.StatusQuestion.Value);
            }
            if (query.StatusQuestionReply.HasValue && query.StatusQuestionReply.Value != -1)
            {
                list = list.Where(i => i.doc.StatusModify == query.StatusQuestionReply.Value);
            }
            var result = list.ToList();
            if (result != null && result.Count > 0)
            {
                ResponseExcel();
                ViewBag.Record = list.ToList();
            }
            else
            {
                Common.AlertRedirect("未搜索到数据", "/doc/exportmanage");
            }
            return View(query);

        }
        private void ResponseExcel()
        {
            Response.Clear();
            Response.Buffer = true;
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyyMMdd") + ".xls");
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType = "application/ms-excel";
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportManage()
        {
            return View();
        }
        #endregion













    }
    #region entity
    /// <summary>
    /// 
    /// </summary>
    public class QueryModel
    {
        public int? DocNO { get; set; }
        public string UserName { get; set; }
        public DateTime? InputStart { get; set; }
        public DateTime? InputEnd { get; set; }
        public int? StatusComplete { get; set; }
        public int? StatusAudit { get; set; }
        public int? StatusQuestion { get; set; }
        public DateTime? AuditStart { get; set; }
        public DateTime? AuditEnd { get; set; }
        /// <summary>
        /// 回应质疑
        /// </summary>
        public int? StatusQuestionReply { get; set; }
    }
    /// <summary>
    /// 
    /// </summary>
    public class DocForShow
    {
        public Doc doc { get; set; }
        public string username { get; set; }

        #region export

        public DocCommon doc0 { get; set; }
        public Doc1 doc1 { get; set; }
        public Doc2 doc2 { get; set; }
        public Doc3 doc3 { get; set; }
        public Doc4 doc4 { get; set; }

        #endregion
    }

    #endregion
}
